﻿using System;
using System.Collections.Generic;
using System.Text;

namespace designmodule.behavioralmodule.Memento
{
    class Main
    {
        void main()
        {
            //发起人运行
            var o = new Originator();
            o.State = "On";
            o.Show();

            //管理者存储备忘录
            var c = new Caretaker();
            c.Memento = o.CreateMemento();


            o.State = "Off";
            o.Show();

            //读取备忘录
            o.SetMemento(c.Memento);
            o.Show();
        }
    }
}
